package com.hzx.demo.activity;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.telephony.CellInfo;
import android.telephony.TelephonyManager;

import com.hzx.demo.R;
import com.hzx.demo.util.Entry;
import com.hzx.demo.util.HZXLog;

import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;

import java.util.List;

/**
 * Created by ldkxingzhe on 2016/6/7.
 */
@EActivity(R.layout.activity_mock_location)
@Entry(desc = "模拟地址", createTime = "2016-06-07 10:53")
public class LocationMockActivity extends AppCompatActivity{
    @SuppressWarnings("unused")
    private static final String TAG = "LocationMockActivity";

    private static final String mocLocationProvider = "mockLocationProvider";

    @Click(R.id.btn_mock_location)
    protected void onMockClick(){
        TelephonyManager manager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        List<CellInfo> infoList = manager.getAllCellInfo();
        HZXLog.v(TAG, "description is %d.", infoList.get(0).describeContents());
        HZXLog.v(TAG, "infoList.size is %d", infoList == null ? 0 : infoList.size());
/*        LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        locationManager.removeTestProvider(mocLocationProvider);
        locationManager.addTestProvider(mocLocationProvider, false, false,
                false, false, true, true, true, 0, 5);
        locationManager.setTestProviderEnabled(mocLocationProvider, true);
        Location mockLocation = new Location(mocLocationProvider);
        mockLocation.setLatitude(39.915168);
        mockLocation.setLongitude(116.403875);
        mockLocation.setAccuracy(100);
        mockLocation.setElapsedRealtimeNanos(System.currentTimeMillis());
        mockLocation.setTime(System.currentTimeMillis());
        locationManager.setTestProviderLocation(mocLocationProvider, mockLocation);*/
    }
}
